import { createRouter, createWebHashHistory } from 'vue-router';
import About from '../components/About.vue';
import Article from '../components/Article.vue';
import Films from '../components/Films.vue';
import Home from '../components/Home.vue';
import News from '../components/News.vue';
import NotFound from '../components/NotFound.vue';

const routes = [
    { path: '/', component: Home },
    { path: '/about', component: About },
    { path: '/news/:id', component: News },
    { path: '/:path(.*)', component: NotFound },
    { path: '/article/:id(\\d+)', component: Article }, // '/article/:id(\\d+)' id一定为number类型
    // { path: '/films/:id+', component: Films },// +号  至少一个参数  多层级 /films/a/b/c  ==》 [ "a", "b", "c" ]
    { path: '/films/:id*', component: Films },//// *号  可有可无参数   多层级 /films/1/2/3  ==》 [ "1", "2", "3" ]
];

const router = createRouter({
    history: createWebHashHistory(),
    routes,
});

export default router;
